home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr29 / fm2_227.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-02-25  |  12KB  |  367 lines

  1. /*
  2.  * FM/2 2.x installation program copyright (c) 1994/95 by M. Kimes
  3.  *
  4.  * This program creates a folder to hold program objects,
  5.  * then creates program objects for each executable.  It only needs to be
  6.  * run once (unless you move the FM/2 directory -- see say notes at end).
  7.  * It also calls MIGINI.CMD if it finds an old FM2.INI file to migrate
  8.  * some information to the new version's FM3.INI file.
  9.  *
  10.  * For unattended installation, remove the lines marked with "NOTE:" below.
  11.  */
  12.  
  13. /* see if we might be in the right directory... */
  14.  
  15. '@Echo off'
  16. 'cls'
  17.  
  18. say'     ┌───────────────────────────────────────────────────────────────────┐'
  19. say'     │                  FM/2 2.x Installation Program                    │'
  20. say'     │             FM/2 is copyright (c) 1993-95 by M. Kimes             │'
  21. say'     │                       All rights reserved                         │'
  22. say'     ├───────────────────────────────────────────────────────────────────┤'
  23. say'     ├───────────────────────────────────────────────────────────────────┤'
  24. say'     │                Have you read the READ.ME file yet?                │'
  25. say'     │        By running this program, you agree to the license          │'
  26. say'     │                     as specified in that file,                    │'
  27. say'     │      and it tells you how to install, so you should read it.      │'
  28. say'     └───────────────────────────────────────────────────────────────────┘'
  29.  
  30. /*
  31.  * allow user to eliminate associations from being placed on AV/2.
  32.  * seemed to upset some fellow on CIS (I guess he doesn't know about
  33.  * Settings notebooks on WPS objects).
  34.  */
  35. assocfilter = ';ASSOCFILTER=*.ZIP,*.ARC,*.LZH,*.ARJ,*.ZOO,*.MO0,READ.ME,README,README.1ST,README.OS2,REGISTER.TXT'
  36. existed = ''
  37. parse upper arg dummy
  38. if dummy = 'NOASSOC' then assocfilter = ''
  39.  
  40. rc = stream('fm3.exe','c','query exists')
  41. if rc = '' then
  42. do
  43.   say 'Sorry, FM3.EXE not found.  Must not be right directory.  Terminating.'
  44.   exit
  45. end
  46.  
  47. /* tell user what we're doing, give him a chance to hit CTRL-C */
  48.  
  49. say ''
  50. say 'This program creates objects for FM/2.'
  51. say ''
  52.  
  53.  
  54.  
  55. /* NOTE:  remove following 3 lines for unattended use... */
  56. say 'Press [Enter].'
  57. pull dummy .
  58. say ''
  59.  
  60.  
  61. /* save current directory */
  62.  
  63. curdir = directory()
  64.  
  65. /* load rexx utility functions */
  66.  
  67. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  68. call SysLoadFuncs
  69.  
  70. /* say it, then do it */
  71.  
  72. say "Creating File Manager/2 folder and objects..."
  73.  
  74. /* first, create FM/2 folder */
  75.  
  76. title = "File Manager/2"
  77. classname = 'WPFolder'
  78. location = '<WP_DESKTOP>'
  79. setup = 'OBJECTID=<FM3_Folder>;OPEN=DEFAULT'
  80. result=SysCreateObject(classname,title,location,setup,f)
  81.  
  82. /* NOTE:  remove following 9 lines for unattended use... */
  83. if result = 0 then
  84. do
  85.   assocfilter = ''
  86.   existed = 'TRUE'
  87.   say ''
  88.   say 'The File Manager/2 folder already exists.'
  89.   say 'Should I update the objects? (Y/N)'
  90.   parse upper pull dummy
  91.   if left(dummy,1) = 'N' then exit
  92.   say ''
  93. end
  94.  
  95. /* now, create program objects in FM/2 folder */
  96.  
  97. title = "FM/2"
  98. classname = 'WPProgram'
  99. location = '<FM3_Folder>'
  100. setup = 'EXENAME='curdir'\FM3.EXE;STARTUPDIR='curdir
  101. if existed = '' then setup = setup';PARAMETERS=%*'
  102. call SysCreateObject classname,title,location,setup,u
  103.  
  104. rc = stream('av2.exe','c','query exists')
  105. if rc \= '' then
  106. do
  107.   title = "Archive Viewer/2"
  108.   classname = 'WPProgram'
  109.   location = '<FM3_Folder>'
  110.   setup = 'EXENAME='curdir'\AV2.EXE;STARTUPDIR='curdir''assocfilter
  111.   if existed = '' then setup = setup';PARAMETERS=%*'
  112.   call SysCreateObject classname,title,location,setup,u
  113. end
  114.  
  115. rc = stream('doicon.exe','c','query exists')
  116. if rc \= '' then
  117. do
  118.   title = "SysIcon"
  119.   classname = 'WPProgram'
  120.   location = '<FM3_Folder>'
  121.   setup = 'EXENAME='curdir'\DOICON.EXE;STARTUPDIR='curdir
  122.   if existed = '' then setup = setup';PARAMETERS=%*'
  123.   call SysCreateObject classname,title,location,setup,u
  124. end
  125.  
  126. rc = stream('eas.exe','c','query exists')
  127. if rc \= '' then
  128. do
  129.   title = "EA Viewer"
  130.   classname = 'WPProgram'
  131.   location = '<FM3_Folder>'
  132.   setup = 'EXENAME='curdir'\EAS.EXE;STARTUPDIR='curdir
  133.   if existed = '' then setup = setup';PARAMETERS=%*'
  134.   call SysCreateObject classname,title,location,setup,u
  135. end
  136.  
  137. rc = stream('ini.exe','c','query exists')
  138. if rc \= '' then
  139. do
  140.   if assocfilter \= '' then assocfilter = ';ASSOCFILTER=*.INI'
  141.   title = "INI Viewer"
  142.   classname = 'WPProgram'
  143.   location = '<FM3_Folder>'
  144.   setup = 'EXENAME='curdir'\INI.EXE;STARTUPDIR='curdir''assocfilter
  145.   if existed = '' then setup = setup';PARAMETERS=%*'
  146.   call SysCreateObject classname,title,location,setup,u
  147. end
  148.  
  149. rc = stream('viewinfs.exe','c','query exists')
  150. if rc \= '' then
  151. do
  152.   title = "Bookshelf Viewer"
  153.   classname = 'WPProgram'
  154.   location = '<FM3_Folder>'
  155.   setup = 'EXENAME='curdir'\VIEWINFS.EXE;STARTUPDIR='curdir
  156.   call SysCreateObject classname,title,location,setup,u
  157.   title = "Helpfile Viewer"
  158.   classname = 'WPProgram'
  159.   location = '<FM3_Folder>'
  160.   setup = 'EXENAME='curdir'\VIEWINFS.EXE;PARAMETERS=DUMMY;STARTUPDIR='curdir
  161.   call SysCreateObject classname,title,location,setup,u
  162. end
  163.  
  164. rc = stream('killproc.exe','c','query exists')
  165. if rc \= '' then
  166. do
  167.   title = "Process Killer"
  168.   classname = 'WPProgram'
  169.   location = '<FM3_Folder>'
  170.   setup = 'EXENAME='curdir'\KILLPROC.EXE;PARAMETERS=%;STARTUPDIR='curdir
  171.   call SysCreateObject classname,title,location,setup,u
  172. end
  173.  
  174. rc = stream('undel.exe','c','query exists')
  175. if rc \= '' then
  176. do
  177.   title = "Undeleter"
  178.   classname = 'WPProgram'
  179.   location = '<FM3_Folder>'
  180.   setup = 'EXENAME='curdir'\UNDEL.EXE;STARTUPDIR='curdir
  181.   if existed = '' then setup = setup';PARAMETERS=%*'
  182.   call SysCreateObject classname,title,location,setup,u
  183. end
  184.  
  185. rc = stream('vtree.exe','c','query exists')
  186. if rc \= '' then
  187. do
  188.   title = "Visual Tree"
  189.   classname = 'WPProgram'
  190.   location = '<FM3_Folder>'
  191.   setup = 'EXENAME='curdir'\VTREE.EXE;STARTUPDIR='curdir
  192.   call SysCreateObject classname,title,location,setup,u
  193. end
  194.  
  195. rc = stream('vdir.exe','c','query exists')
  196. if rc \= '' then
  197. do
  198.   title = "Visual Directory"
  199.   classname = 'WPProgram'
  200.   location = '<FM3_Folder>'
  201.   setup = 'EXENAME='curdir'\VDIR.EXE;STARTUPDIR='curdir
  202.   if existed = '' then setup = setup';PARAMETERS=%*'
  203.   call SysCreateObject classname,title,location,setup,u
  204. end
  205.  
  206. rc = stream('vcollect.exe','c','query exists')
  207. if rc \= '' then
  208. do
  209.   title = "Collector"
  210.   classname = 'WPProgram'
  211.   location = '<FM3_Folder>'
  212.   setup = 'EXENAME='curdir'\VCOLLECT.EXE;STARTUPDIR='curdir
  213.   call SysCreateObject classname,title,location,setup,u
  214. end
  215.  
  216. rc = stream('READ.ME','c','query exists')
  217. if rc \= '' then
  218. do
  219.   title = "Read.Me"
  220.   classname = 'WPShadow'
  221.   location = '<FM3_Folder>'
  222.   setup = 'SHADOWID='rc
  223.   call SysCreateObject classname,title,location,setup,u
  224. end
  225.  
  226. rc = stream('HISTORY.TXT','c','query exists')
  227. if rc \= '' then
  228. do
  229.   title = "History.Txt"
  230.   classname = 'WPShadow'
  231.   location = '<FM3_Folder>'
  232.   setup = 'SHADOWID='rc
  233.   call SysCreateObject classname,title,location,setup,u
  234. end
  235.  
  236. rc = stream('REGISTER.TXT','c','query exists')
  237. if rc \= '' then
  238. do
  239.   title = "Register.Txt"
  240.   classname = 'WPShadow'
  241.   location = '<FM3_Folder>'
  242.   setup = 'SHADOWID='rc
  243.   call SysCreateObject classname,title,location,setup,u
  244. end
  245.  
  246. rc = stream('ASSOCIAT.TXT','c','query exists')
  247. if rc \= '' then
  248. do
  249.   title = "Associat.Txt"
  250.   classname = 'WPShadow'
  251.   location = '<FM3_Folder>'
  252.   setup = 'SHADOWID='rc
  253.   call SysCreateObject classname,title,location,setup,u
  254. end
  255.  
  256. rc = stream('FM3.HLP','c','query exists')
  257. if rc \= '' then
  258. do
  259.   if assocfilter \= '' then assocfilter=';ASSOCFILTER=*.HLP'
  260.   rc = stream('SEEHELP.EXE','c','query exists')
  261.   if rc \= '' then
  262.   do
  263.     title = "FM/2 Online Help"
  264.     classname = 'WPProgram'
  265.     location = '<FM3_Folder>'
  266.     setup = 'EXENAME='curdir'\SEEHELP.EXE;STARTUPDIR='curdir';PARAMETERS= %* 'curdir'\FM3.HLP'
  267.     call SysCreateObject classname,title,location,setup,u
  268.   end
  269. end
  270.  
  271. /*
  272.  * create an FM2.CMD file that the user can copy into a directory
  273.  * in their PATH if they'd like to be able to start FM/2 from any
  274.  * directory via command line.
  275.  */
  276.  
  277. 'del FM2.CMD 1>NUL 2>NUL'
  278. dummy = stream('FM2.CMD','C','open')
  279. if dummy = 'READY:' then
  280. do
  281.   say 'Creating an FM2.CMD file.'
  282.   call lineout 'FM2.CMD', "/* FM/2 command file.  Locate in a directory"
  283.   call lineout 'FM2.CMD', " * on your PATH. */"
  284.   call lineout 'FM2.CMD', "'@echo off'"
  285.   call lineout 'FM2.CMD', "arg dummy"
  286.   call lineout 'FM2.CMD', "if dummy = '' then"
  287.   call lineout 'FM2.CMD', "  curdir = directory()"
  288.   call lineout 'FM2.CMD', "else"
  289.   call lineout 'FM2.CMD', "  curdir = ''"
  290.   call lineout 'FM2.CMD', "n = setlocal()"
  291.   call lineout 'FM2.CMD', "n = directory('"curdir"')"
  292.   call lineout 'FM2.CMD', "'start fm3.exe 'curdir' %1 %2 %3 %4 %5 %6 %7 %8 %9'"
  293.   call lineout 'FM2.CMD', "n = endlocal()"
  294.   call stream 'FM2.CMD','C','close'
  295.   'del AV2.CMD 1>NUL 2>NUL'
  296.   dummy = stream('AV2.CMD','C','open')
  297.   if dummy = 'READY:' then
  298.   do
  299.     say 'Creating an AV2.CMD file.'
  300.     call lineout 'AV2.CMD', "/* AV/2 command file.  Locate in a directory"
  301.     call lineout 'AV2.CMD', " * on your PATH. */"
  302.     call lineout 'AV2.CMD', "'@echo off'"
  303.     call lineout 'AV2.CMD', "arg arg1"
  304.     call lineout 'AV2.CMD', "if arg1 \= '' then arg1 = stream(arg1,'c','query exists')"
  305.     call lineout 'AV2.CMD', "n = setlocal()"
  306.     call lineout 'AV2.CMD', "n = directory('"curdir"')"
  307.     call lineout 'AV2.CMD', "'start av2.exe 'arg1"
  308.     call lineout 'AV2.CMD', "n = endlocal()"
  309.     call stream 'AV2.CMD','C','close'
  310.   end
  311.   else say "Couldn't create AV2.CMD file."
  312.   say ''
  313. end
  314. else say "Couldn't create FM2.CMD file."
  315. say ''
  316.  
  317. rc = stream('fm3.ini','c','query exists')
  318. if rc \= '' then
  319.   say 'An FM3.INI exists -- not attempting to migrate 1.x information.'
  320. else
  321. do
  322.   /* if we can find FM2.INI, run MIGINI.CMD */
  323.   fm2ini = value('fm2ini',,'OS2ENVIRONMENT')
  324.   if fm2ini \= '' then fm2ini = stream(fm2ini,'c','query exists')
  325.   if fm2ini = '' then
  326.   do
  327.     fm2ini = value('fm2ini',,'OS2ENVIRONMENT')
  328.     if fm2ini \= '' then
  329.     do
  330.       fm2ini = insert('\FM2.INI',fm2ini,length(fm2ini))
  331.       fm2ini = stream(fm2ini,'c','query exists')
  332.     end
  333.   end
  334.   fm2ini = SysSearchPath('PATH', 'FM2.INI')
  335.   if fm2ini = '' then fm2ini = SysSearchPath('DPATH', 'FM2.INI')
  336.   if fm2ini = '' then fm2ini = SysSearchPath('XPATH', 'FM2.INI')
  337.   if fm2ini \= '' then
  338.   do
  339.     'call migini.cmd dummy'
  340.     say ''
  341.     say '  (You can remove the old FM/2 1.x files when installation completes.)'
  342.     call SysSleep 2
  343.     say ''
  344.   end
  345. end
  346.  
  347. rc = stream('install.dat','c','query exists')
  348. if rc \= '' then
  349. do
  350.   /* type the install.dat file to show any critical info/notices */
  351.  
  352.   /* NOTE:  remove following 4 lines for unattended use... */
  353.   rc = stream('install.dat','c','query exists')
  354.   if rc \= '' then 'type install.dat'
  355.   say 'Press [Enter].'
  356.   pull dummy .
  357. end
  358.  
  359. say 'To move FM/2 to another directory, move the files, delete the FM/2 folder,'
  360. say 'then rerun INSTALL.  To remove FM/2, run UNINSTAL and follow its directions.'
  361. say "If you'd like to be able to run FM/2 from any OS/2 command line, copy the"
  362. say 'FM2.CMD file in this directory to a directory on your PATH.  I also built'
  363. say 'an AV2.CMD file you may also want on your PATH.'
  364. say ''
  365. say "I'm done now."
  366.  
  367.